import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '询报价编码',
    dataIndex: 'rfqCode',
  },
  {
    title: '询报价名称',
    dataIndex: 'rfqName',
  },
  {
    title: '总价',
    dataIndex: 'goodsAmount',
  },
  // {
  //   title: '自定义报价主题',
  //   dataIndex: 'rfqTheme',
  // },
  // {
  //   title: '审核人',
  //   dataIndex: 'auditUser',
  // },
  // {
  //   title: '审核时间',
  //   dataIndex: 'auditTime',
  // },
  {
    title: '询价状态',
    dataIndex: 'auditStatus_dictText',
  },
  // {
  //   title: '审核原因',
  //   dataIndex: 'auditReason',
  // },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '询报价编码',
    field: 'rfqCode',
    component: 'Input',
    componentProps: {
      placeholder: '请输入询报价编码',
    },
  },
];

export const formSchema: FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  { label: '', field: 'id', component: 'Input', show: false },
  {
    label: '询价编码',
    field: 'rfqCode',
    component: 'Input',
    componentProps: {
      placeholder: '系统自动生成',
      disabled: true, // 编码由系统生成，用户不可编辑
    },
    // 添加生成规则说明
    helpMessage: ['编码采用shop_order_num生成规则'],
    colProps: { span: 8 },
  },
  {
    label: '询价名称',
    field: 'rfqName',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    label: '期望交付日期',
    field: 'createTime',
    component: 'DatePicker',
    helpMessage: ['买家希望收到货物的时间'],
    componentProps: {
      style: { width: '100%' },
      placeholder: '请选择报价日期',
    },
    colProps: { span: 8 },
  },
  {
    label: '询价有效期',
    field: 'validDays',
    component: 'InputNumber',
    componentProps: {
      style: { width: '100%' },
      placeholder: '请输入询价有效期(天)',
      min: 1,
      step: 1,
    },
    colProps: { span: 8 },
  },
  {
    label: '询价日期',
    field: 'createTime',
    component: 'DatePicker',
    helpMessage: ['询价单提交日期'],
    componentProps: {
      style: { width: '100%' },
      placeholder: '请选择询价日期',
    },
    colProps: { span: 8 },
  },
  {
    label: '询价状态 ',
    field: 'auditStatus',
    component: 'JDictSelectTag', // 改为字典下拉选项
    defaultValue: '0',
    dynamicDisabled: true,
    componentProps: {
      dictCode: 'audit_status', // 假设审核状态字典编码为audit_status
      placeholder: '请选择审核状态',
      allowClear: true,
      showSearch: true,
    },
    colProps: { span: 8 },
  },
];
